package com.peng.leetcode.dynamic;

/**
 * UniquePaths
 *
 * @author: lupeng6
 * @create: 2020/12/29 22:41
 */
public class UniquePaths {

    public static void main(String[] args) {
        System.out.println(new UniquePaths().uniquePaths(3, 7));
    }


    public int uniquePaths(int m, int n) {
        int[][] board = new int[m][n];
        for (int i = 0; i < m; i++) {
            board[i][0] = 1;
        }
        for (int i = 0; i < n; i++) {
            board[0][i] = 1;
        }
        for (int i = 1; i < m; i++) {
            for (int j = 1; j < n; j++) {
                board[i][j] = board[i - 1][j] + board[i][j - 1];
            }
        }
        return board[m - 1][n - 1];
    }
}
